<!--
 * @Description:用户设置左侧树
 * @Version: 2.0
 * @Autor: kafei
 * @Date: 2021-11-26 16:15:22
 * @LastEditors: kafei
 * @LastEditTime: 2021-11-29 16:40:42
-->
<template>
  <div class="systemUser__leftTree z-w-100">
    <div class="systemUser__leftTree__header flex-between">
      <el-input
        v-model="searchValue"
        placeholder="请搜索部门"
        prefix-icon="el-icon-search"
        size="small"
      />
    </div>
    <div class="systemUser__content">
      <el-scrollbar>
        <baseTree
          :data="treeData"
          node-key="depId"
          @treeClick="treeClick"
        />
      </el-scrollbar>
    </div>
  </div>
</template>

<script>
import { getAllDepartMent } from '@/api/systemUser'
import baseTree from '@/components/baseTree/index.vue'
export default {
  components: {
    baseTree
  },
  data () {
    return {
      treeData: [],
      searchValue: ''
    }
  },
  created () {
    this.getAllDepartMentFun()
  },
  methods: {
    treeClick (node) {
      this.$emit('treeClick', node)
    },
    async getAllDepartMentFun () {
      const result = await getAllDepartMent()
      if (result.code === '0') {
        this.treeData = result.data
      }
    }
  }
}
</script>
